import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InvoicingMethodVO, InvoicingMethodForm, InvoicingMethodQuery } from '@/api/goods/contractType/types';

/**
 * 查询开票方式列表
 * @param query
 * @returns {*}
 */

export const listInvoicingMethod = (query?: InvoicingMethodQuery): AxiosPromise<InvoicingMethodVO[]> => {
  return request({
    url: '/order/invoicingMethod/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询开票方式详细
 * @param id
 */
export const getInvoicingMethod = (id: string | number): AxiosPromise<InvoicingMethodVO> => {
  return request({
    url: '/order/invoicingMethod/' + id,
    method: 'get'
  });
};

/**
 * 新增开票方式
 * @param data
 */
export const addInvoicingMethod = (data: InvoicingMethodForm) => {
  return request({
    url: '/order/invoicingMethod',
    method: 'post',
    data: data
  });
};

/**
 * 修改开票方式
 * @param data
 */
export const updateInvoicingMethod = (data: InvoicingMethodForm) => {
  return request({
    url: '/order/invoicingMethod',
    method: 'put',
    data: data
  });
};

/**
 * 删除开票方式
 * @param id
 */
export const delInvoicingMethod = (id: string | number | Array<string | number>) => {
  return request({
    url: '/order/invoicingMethod/' + id,
    method: 'delete'
  });
};


export default {
  list:listInvoicingMethod,
  get:getInvoicingMethod,
  add:addInvoicingMethod,
  update:updateInvoicingMethod,
  del:delInvoicingMethod
}
